<?php
namespace LPCISII\PHP2012Bundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;


class CategorieController extends Controller
{
    public function indexAction($selected=null) {
        $em = $this->getDoctrine()->getEntityManager();
        $categories = $em->createQueryBuilder()
                            ->select('c')
                            ->from('LPCISIIPHP2012Bundle:Categories', 'c')
                            ->getQuery()
                            ->getResult();
        return $this->render('LPCISIIPHP2012Bundle:Page:categorylist.html.twig', array(
            'categories' => $categories,
            'selected'  => $selected
        ));
    }     
}